"use strict";
const nodemailer = require("nodemailer");


// 使用默认的SMTP传输创建可重用的传输器对象
let transporter = nodemailer.createTransport({
  host: "smtp.qq.com",  //发送方邮箱。在/node_modules/lib/well-known/services.json可查
  port: 465,
  secure: true, // true for 465, false for other ports
  auth: {
    user: "2643558461@qq.com", // 邮箱地址
    pass: "ebfrzgqcsyysecje", // smtp验证码
  },
});

//邮件信息
let info = {
  from: '"Fred Foo 👻" <2643558461@qq.com>', // sender address
  to: "sq.8000000@qq.com", // list of receivers
  subject: "Hello ✔", // Subject line
  //text: "Hello world?", // text与html只能使用一个
  html: "<b>Hello world?</b>", // html body
};
transporter.sendMail(info, (err, info) => {
  if (err) console.log(err);
  else {
    console.log("发送成功 ");
  }
})
//封装一个自定义模块，向邮箱发送固定的信息
//xxx.send("email",info)



  // console.log("Message sent: %s", info.messageId);
  // Message sent: <b658f8ca-6296-ccf4-8306-87d57a0b4321@example.com>
